1. Field of the Invention
The present invention relates to a microprocessor including saturation arithmetic instructions as multimedia instructions for setting an arithmetic result into a predetermined value of optional bit length when an overflow has occurred.
2. Description of Related Art
There are applications requiring execution of saturation operations when an overflow has occurred as an operation result of an operation circuit. In order to consent to this request, there are microprocessors having conventional saturation operation instructions. For example, there are the microprocessors having conventional saturation operation instructions disclosed in the literatures, Japanese laid-open publication numbers: JP-A-7/210368, JP-A-7/49767, JP-A-5/313856, JP-A-7/334346 and JP-A-4/315275.
Like video code processing based on MPEG2, it must be required to perform a saturation operation to saturate data into data having a maximum-bit length during decode operation in an application to provide a data item of a relatively smaller-bit length as a decoding result. For example, when an operation result becomes "1000 (without sign)" it must be required to saturate this operation result into "1111 (without sign)". Further, it must also be required to perform saturation operations in which each of results of decoding operations is saturated into data having its maximum bit length according to kinds of the decoding operations. In general, picture elements (or pixels) of data of moving pictures are expressed by three types of colors, R (red), G (green) and B (blue) and each R, G and B is given with four-bits, six-bits or eight bits. When four-bits are used for each of R, G and B, 4096 kinds of colors can be expressed. When six-bits for each, approximately 260 hundred types of colors can be shown and when eight bits, approximately 16.7 million kinds of colors can be expressed. Thus, the number of bits to be used is different according to the number of colors to be expressed. This requires to execute saturation operations in order to set processing resultants into the maximum value in each of many types of bit lengths corresponding to kinds of the data processing.
In the MMX architecture advanced by Intel corp. as multimedia extended instructions, new 57 instructions are added into an instruction set. In the instruction set, there are following added saturation instructions which are combination instructions combined between saturation operations and other operations:
PACKUSWB: Generate one byte data type from two word data types (without sign), PA1 PACKSS WB, DW!: Generate byte type data, word type data! from word type data, double word type data! (with sign), PA1 PADDS B, W!: Add byte type data, word type data! (with sign), PA1 PADDUS B, W!: Add byte type data, word type data! (without sign), PA1 PSUBS B, W!: Subtract byte type data, word type data! (with sign), and PA1 PSUBUS B, W!: Subtract byte type data, word type data! (without sign).
Each of the instructions described above can operate saturation operation only for one byte data or one word data, but can not perform any saturation operation for data having optional bit length in one instruction. In the PA-RISC introduced by Hewlett Packard corp., it must be required to perform several instructions in order to perform saturation operation for data having optional bit length, namely it is difficult to perform it in one instruction.
Since the conventional microprocessors have the configuration described above, it is difficult to perform any saturation operation for data having optional bit length in one instruction and it also be difficult for the conventional microprocessors to provide convenient multimedia instructions capable of processing saturation operations at high speed rate.